//
//  NoticeListViewController.swift
//  ModernFoodWebsite
//
//  Created by apple on 16/5/30.
//  Copyright © 2016年 Lonnie. All rights reserved.
//

import UIKit

class NoticeListViewController: BaseTableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.rowHeight = UITableViewAutomaticDimension
        tableView.estimatedRowHeight = 100
        tableView.registerClass(NoticeListCell.classForCoder(), forCellReuseIdentifier: "item")
        addCommonStyleBackItem()
    }
 

}
extension NoticeListViewController {
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10
    }
    
    override func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
        tableView.deselectRowAtIndexPath(indexPath, animated: true)
        performSegueWithIdentifier("detail", sender: nil)
    }
    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("item") as! NoticeListCell
        let num = random() % 4
        var images:[UIImage] = []
        for i in 0 ..< num {
            images.append(UIImage(named:"information_pic\(i+1)")!)
        }
        cell.titleLabel.text = "厂家供应山东白鸽MZX65型馒头整形机全自动馒头机"
        cell.setImages(images)
        cell.avaitarImageView.image = UIImage(named:"information_pic1")
        cell.timeLabel.text = "12.12 12:00"
        cell.selectionStyle = .None
        return cell
    }
}